﻿<UserControl x:Class="AzureVMDashboard.UI.VMControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:ui="clr-namespace:AzureVMDashboard.UI"
             mc:Ignorable="d" 
             d:DesignHeight="40" d:DesignWidth="300">
    <UserControl.Resources>
        <ui:VMStatusToColorConverter x:Key="VMStatusToColor" />
        <ui:VMStatusToTooltipConverter x:Key="VMStatusToTooltip" />
    </UserControl.Resources>

    <Grid>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="50"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="70"/>
                <ColumnDefinition Width="70"/>
                <ColumnDefinition Width="70"/>
            </Grid.ColumnDefinitions>

            <Rectangle Fill="{Binding Status, Converter={StaticResource VMStatusToColor}}"
                       ToolTip="{Binding Status, Converter={StaticResource VMStatusToTooltip}}"
                       Opacity="0.7" Width="35" Height="20">
                <Rectangle.OpacityMask>
                    <VisualBrush Visual="{StaticResource appbar_cloud}" Stretch="Fill" />
                </Rectangle.OpacityMask>
            </Rectangle>

            <TextBlock Text="{Binding Name}" Grid.Column="1" Style="{StaticResource VMName}"/>

            <Button Click="StartClick" Grid.Column="2" IsEnabled="{Binding CanBeStarted}" Style="{StaticResource CmdButtonTransparent}">
                <Rectangle Width="20" Height="20">
                    <Rectangle.Fill>
                        <VisualBrush Stretch="Fill" Visual="{StaticResource appbar_play}" />
                    </Rectangle.Fill>
                </Rectangle>
            </Button>

            <Button Click="StopClick" Grid.Column="3" IsEnabled="{Binding CanBeStopped}" Style="{StaticResource CmdButtonTransparent}">
                <Rectangle Width="20" Height="20">
                    <Rectangle.Fill>
                        <VisualBrush Stretch="Fill" Visual="{StaticResource appbar_stop}" />
                    </Rectangle.Fill>
                </Rectangle>
            </Button>

            <Button Click="RdpClick" Grid.Column="4" IsEnabled="{Binding SupportRDP}" Style="{StaticResource CmdButtonTransparent}">
                <Rectangle Width="20" Height="20">
                    <Rectangle.Fill>
                        <VisualBrush Stretch="Fill" Visual="{StaticResource appbar_monitor}" />
                    </Rectangle.Fill>
                </Rectangle>
            </Button>
            
        </Grid>
    </Grid>
</UserControl>
